magnifier: Use new snapshot transforms
authorBenjamin Otte <otte@redhat.com>
Thu, 21 Feb 2019 04:34:12 +0000 (05:34 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 21 Feb 2019 18:47:28 +0000 (19:47 +0100)
gtk/gtkmagnifier.c

index 0ddbdd882c6ded7785385872f82ce38233785ce0..9d99898b3a6352a2e5e1941bc6e3778f817e02ad 100644 (file)
@@ -103,7 +103,6 @@ gtk_magnifier_snapshot (GtkWidget   *widget,
 {
   GtkMagnifier *magnifier = GTK_MAGNIFIER (widget);
   GtkMagnifierPrivate *priv = gtk_magnifier_get_instance_private (magnifier);
-  graphene_matrix_t transform;
   double width, height, paintable_width, paintable_height;
 
   if (gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (priv->paintable)) == NULL)
@@ -116,19 +115,16 @@ gtk_magnifier_snapshot (GtkWidget   *widget,
   if (paintable_width <= 0.0 || paintable_height <= 0.0)
     return;
 
-  graphene_matrix_init_translate (&transform, &GRAPHENE_POINT3D_INIT (
-                                 - CLAMP (priv->x, 0, paintable_width),
-                                 - CLAMP (priv->y, 0, paintable_height),
-                                 0
-                             ));
-
-  graphene_matrix_scale (&transform, priv->magnification, priv->magnification, 1);
+  gtk_snapshot_save (snapshot);
   if (!priv->resize)
-    graphene_matrix_translate (&transform, &GRAPHENE_POINT3D_INIT (width / 2, height / 2, 0));
+    gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2, height / 2));
+  gtk_snapshot_scale (snapshot, priv->magnification, priv->magnification);
+  gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (
+                          - CLAMP (priv->x, 0, paintable_width),
+                          - CLAMP (priv->y, 0, paintable_height)));
 
-  gtk_snapshot_push_transform (snapshot, &transform);
   gdk_paintable_snapshot (priv->paintable, snapshot, paintable_width, paintable_height);
-  gtk_snapshot_pop (snapshot);
+  gtk_snapshot_restore (snapshot);
 }
 
 static void